home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / cg / import.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-11  |  3KB  |  99 lines

  1. /* Import.rexx -- Import Graphics Via Hiip.                */
  2. /* By Bob Caron © 1994 NewTek, Inc.                        */
  3. /* A Big hello to everybody on #amiga - Grue               */
  4.  
  5. call addlib(CG_AREXX,0)
  6.  
  7. if ~exists("Toaster:Brushes") then address command "c:makedir toaster:Brushes"
  8. address command "c:assign hiip: toaster:programs/hiip_support"
  9. if ~exists("hiip:") then do
  10.    call req_tell("Error! Hiip_Support","Is missing.")
  11.    exit
  12.    end
  13.  
  14. if ~exists("c:gnusto") then do
  15.    call req_tell("Error! The Program","Gnusto Is missing!")
  16.    exit
  17.    end
  18.  
  19. width=0
  20. height=0
  21.  
  22.  
  23. if GET_LINE(TYPE) = 'Box' then do
  24.    width=word(get_rect(SIZE),1)
  25.    height=word(get_rect(SIZE),2)
  26.    end
  27.  
  28. if (width+height)<=0 then do
  29.    call req_tell("Error: You must create a box","and then select it.")
  30.    exit
  31.    end
  32.  
  33. filnam = 'ENV:CGImport.state'
  34. version = 'Import v1.4'
  35.  
  36. if (exists(filnam)) then do
  37.     if (~open(state, filnam, 'R')) then break
  38.     if (readln(state) ~= version) then break
  39.     file=readln(state)
  40.     end
  41.     call close state
  42.  
  43. if file~="" | file="FILE" then do
  44.    if lastpos('/',file,length(file)-1)~=0 then do
  45.       filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  46.       path=left(file,(lastpos('/',file,length(file))-1))
  47.       end
  48.    else do
  49.       filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  50.       path=left(file,(lastpos(':',file,length(file))))
  51.       end
  52.    end
  53. if file="FILE" | file="" then do
  54.    path="Toaster:images"
  55.    filenam=""
  56.    end
  57.  
  58. infile=REQ_file("Choose a graphic file:",filenam,path)
  59.  
  60.  
  61. if infile="" then
  62.    exit
  63.  
  64. file=script
  65. if (open(state, filnam, 'W')) then do
  66.     call writeln state, version
  67.     call writeln state, infile
  68.     call close state
  69.     end
  70.  
  71. if req_ask("Peserve Aspect?") then width=0
  72.  
  73. if lastpos('/',infile,length(infile)-1)~=0 then do
  74.    filenam=right(infile,(length(infile)-lastpos('/',infile,length(infile)-1)))
  75.    path=left(infile,(lastpos('/',infile,length(infile))-1))
  76.    end
  77. else do
  78.    filenam=right(infile,(length(infile)-lastpos(':',infile,length(infile)-1)))
  79.    path=left(infile,(lastpos(':',infile,length(infile))))
  80.    end
  81.  
  82. call req_bar("Converting Graphic...")
  83. address command "C:gnusto "||infile||" Toaster:brushes/"||value(filenam)||"."||value(height)||" image saver iff sy "||value(height)||" sx "||value(width)||" sn bestup"
  84.  
  85.  
  86. call LOADBRUSH("toaster:brushes/"||value("filenam")||"."||value(height))
  87. call set_char(face,value("filenam")||"."||value(height))
  88. call req_tell("Converted and loaded:",value("filenam")||"."||value("height"))
  89.  
  90. call req_bar("ToasterCG")
  91. call REMLIB(CG_AREXX)
  92.  
  93. exit
  94.  
  95.  
  96.  
  97.  
  98.  
  99.